package com.tbit.main.controller;

import com.tbit.main.service.OperationReportsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 启动定时任务
 *
 * @author LMY
 * @create 2021-01-13 23:16
 */
@RestController
@RequestMapping(value = "/quartz")
public class QuartzController {
    @Resource
    private OperationReportsService operationReportsService;

    /**
     * 区域统计，第一次执行为true
     *
     * @param flag
     */
    @RequestMapping("/start")
    public void start(Boolean flag) {
        /**为true就批量删除保存统计的区域redis信息*/
        if (flag) {
            operationReportsService.batchDelRedis();
        }
        operationReportsService.operationDayCount();
    }

    /**
     * 分区统计
     *
     * @param flag
     */
    @RequestMapping("/geoStart")
    public void geoStart(Boolean flag) {
        /**为true就批量删除保存统计的区域redis信息*/
        if (flag) {
            operationReportsService.batchRegionDelRedis();
        }
        operationReportsService.geoDayCount();
    }

}
